<template>
  <div class="tempFW ">

    <div class="goXw" >
      <template v-if="!justSee">
        <ul class="xireR">
          <li  :class="bz_switch_type==1?'active':''" @click="bz_switch_type=1">以补正形式答复</li>
          <li  :class="bz_switch_type==2?'active':''" @click="bz_switch_type=2">以OA形式答复</li>
        </ul>
      </template>
      <div :class="justSee?' ':' xZk '">
        <div v-show="bz_switch_type==1">
          <!-- 补正自动化提交框 -->
          <div class="title" v-show="!justSee">
            <span class="cRed f_16 f_bold" >*</span>
            补正：
              <Button type="primary" class="pointer marginR10" size="small" shape="circle" @click="xbvw" :disabled="buZList.length>=25">
                <Icon type="md-add" />新增
              </Button>
              <span class=" f_bold lineH2">{{buZList.length}}</span> / 25
            
          </div>
          <div class="htow" :style="justSee?('max-height:'+($app.winHeight-150)+'px;'):''">
            <template v-for="(val,i) in buZList">
              <div class="bizUl">
                <Row :gutter="15">
                  <Col :span="12">
                  <div class="lineH2">
                    <div class="pullLeft lineH2" style="width:60px">补正 {{i+1}}</div>
                    <div class="overflowH">
                      <Input
                        v-model="val.filename"
                        :placeholder="'请输入文件名称'"
                        :ref="'filename'+i"
                        :disabled="justSee"
                        clearable
                      />
                    </div>
                  </div>
                  </Col>
                  <Col :span="11">
                    <template v-if="(val.cpcInfo).length==1">
                      <template class="fengGeT" v-for="(jar,r) in val.cpcInfo" >
                        <div class="pullLeft lineH2" style="width:110px">文件中的位置：</div>
                        <div class=" overflowH ">
                          <Input
                            v-model="jar.position"
                            :ref="'position'+i+'-'+r"
                            :placeholder="'请输入文件中的位置'"
                            :disabled="justSee"
                            clearable
                          />
                        </div>
                      </template>
                    </template>
                    
                  </Col>
                  <!-- <Col :span="4">
                    <div class="pullLeft lineH2" style="width:50px">页数：</div>
                    <div class="overflowH">
                      <Input
                        v-model="val.pages"
                        type="number"
                        onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
                        :ref="'pages'+i"
                        :disabled="justSee"
                        clearable
                      />
                    </div>
                  </Col> -->
                  <Col :span="1">
                    <Icon
                      v-show="i>0 && !justSee"
                      type="md-close"
                      size="20"
                      class="relative cCCC pointer"
                      style="top:5px;"
                      @click="vwPe(i)"
                    />
                  </Col>
                </Row>

                <template class="fengGeT" v-for="(jar,r) in val.cpcInfo" >
                  
                  <template v-if="(val.cpcInfo).length>1">
                    <div class="marginT10">
                      <div class="pullLeft lineH2" style="width:110px">文件中的位置：</div>
                      <div class=" overflowH ">
                        <Input
                          v-model="jar.position"
                          :ref="'position'+i+'-'+r"
                          :placeholder="'请输入文件中的位置'"
                          :disabled="justSee"
                          clearable
                        />
                      </div>
                    </div>
                  </template>

                  <Row :gutter="15" class="marginT10">
                    <Col :span="12">
                      <div style="width:60px" class="pullLeft lineH2">补正前:</div>
                      <div class="overflowH">
                        <Input
                          type="textarea"
                          placeholder="请输入补正前内容"
                          v-model="jar.before"
                          :rows="2"
                          :disabled="justSee"
                          :ref="'before'+i+'-'+r"
                        />
                      </div>
                    </Col>
                    <Col :span="12">
                      <div style="width:60px" class="pullLeft lineH2">补正后:</div>
                      <div class="overflowH">
                        <Input
                          type="textarea"
                          placeholder="请输入补正后内容"
                          v-model="jar.after"
                          :rows="2"
                          :disabled="justSee"
                          :ref="'after'+i+'-'+r"
                        />
                      </div>
                    </Col>
                  </Row>
                </template>

                


              </div>
            </template>
          </div>
        </div>
        <div v-show="bz_switch_type==2">
          <OAone ref="OAone"/>
        </div>
      </div>

    </div>
    
  </div>
</template>

<style lang="less" scoped>
  @import './less/bzOaAuto.less';
</style>


<script>
import OAone from './oAone';
export default {
  name: "bzOaAuto",
  components: {OAone},
  data() {
    let data = {
      bz_switch_type:1,
      buZList: [
        {
          filename: "",
          pages: "",
          cpcInfo: [{ position: "", before: "", after: "" }]
        }
      ]
    };
    let tool = {
      justSee: false //仅查看，不能编辑
    };
    return Object.assign(data, tool);
  },
  // watch:{
  //   buZList(newVal,oldVal){
  //     console.log('尽力啊这里',newVal)
  //     this.buZList=newVal;
  //   }
  // },
  mounted() {},
  methods: {
    xbvw(){
      this.buZList.push({
        filename: "",
        pages: "",
        cpcInfo: [{ position: "", before: "", after: "" }]
      });
    },
    //删除
    vwPe(i){
      let { buZList } = this;
      this.buZList = $app.arrayDelOne(buZList, i);
    },
  }
};
</script>

